#ifndef __VSDL_ANIMATION_H__
#define __VSDL_ANIMATION_H__

#include "VSDL_image.h"
#include "VSDL_point.h"

using namespace std;

enum VSDL_AnimationStatus{
	ANIMATION_NORMAL = 0,
	ANIMATION_PAUSED
};

class VSDL_Animation{
protected:
	enum VSDL_AnimationStatus status;
	int maxFrames;
	int currentFrame;
	int frameInc;
	bool oscillate; //If true,then NextFrame()(assume maxFrames is 3 and frameInc is 1) will act like: 1 2 3 2 1 2 3 2...
public:
	VSDL_Animation();
	VSDL_Animation(int maxFrames);
	VSDL_Animation(int maxFrames, bool oscillate);
	virtual int OnAnimation();
	void EnableOscillate();
	void DisableOscillate();
	void SetMaxFrames(int maxFrames);
	void SetFrameInc(int frameInc);
	void SetFrame(int frame);
	void Pause();
	void PauseAtFrame(int frame);
	void Resume();
	void ResumeAtFrame(int frame);
	int GetMaxFrames();
	int GetCurrentFrame();
	int GetFrameInc();
	bool IsOscillated();
	bool IsPaused();
	
};

class VSDL_FrameIndependentAnimation : public VSDL_Animation{
private:
	int lastTick;
	int frameInterval; //In ms
public:
	VSDL_FrameIndependentAnimation();
	VSDL_FrameIndependentAnimation(int maxFrames, int frameInterval);
	VSDL_FrameIndependentAnimation(int maxFrames, int frameInterval, bool oscillate);	
	void SetFrameInterval(int frameInterval);
	int GetFrameInterval();
	int OnAnimation();
};

#endif /*__VSDL_ANIMATION_H__*/
